import Taro from "@tarojs/taro";
import { memo, useEffect, useState } from "react";
import { ScrollView, Text, View, Image, Input } from "@tarojs/components";
import { Popup, Button, Overlay } from "@nutui/nutui-react-taro";
import { login } from "../../api/user";
import { setStore, getStore } from "../../utils/localStore";
import calssNames from "classnames";
import { iconRightBlack, iconRightGray } from "../../assets/files";
import "./index.scss";

const InputItem = (props) => {
  const {label,value,placeholder,disabled,required,style,onChange,type,max,labelStyle,labelClass} =  props

  return (
    <View className="inputWrap" style={style}>
      {
        required ?
        <Text className="xing">*</Text>
        :
        <Text className="mo"></Text>
      }
        <Text className={calssNames(`itemLabel,${labelClass}`)} style={labelStyle}>{label}</Text>
        <Input
         disabled={disabled} 
         className="inputValue" 
         style={{color: value ? "#212121" : '#999'}}
         value={value} 
         type={type}
         maxlength={max}
         placeholder={placeholder}
         placeholderTextColor="#999"
         onChange={(e) => {
          onChange(e?.detail?.value)
        }}
         />
      </View>
  );
}

export default InputItem;
